package com.zzyl.task;

import com.zzyl.mapper.DeviceDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description task
 * @Author lyh
 * @Date 2024-11-04
 */
@Component
public class task {
    @Autowired
    private DeviceDataMapper deviceDataMapper;
    @Scheduled(cron="0 0 1 * * ?")
    public void clearDeviceData(){
        List<Long> ids=deviceDataMapper.selectMoreMonth();
        if(ids==null ||ids.size()==0){
            return;
        }
        deviceDataMapper.deleteMoreMonth(ids);
    }
}
